Function.prototype.bind = function (context, ...args) {
    const ctx = context || window;
    const fn = this;

    // 要加函数名，外部有可能用new，需要判断原型链关系
    return function newFn(...others) {
        const params = [...args, ...others];
        if (this instanceof newFn) {
            return new fn(...params)
        }
        const result = fn.call(ctx, ...params);
        return result
    }
}